import { IPSSubSysServiceAPI } from './ipssub-sys-service-api';
import { IPSSubSysServiceAPIDEField } from './ipssub-sys-service-apidefield';
import { IPSSubSysServiceAPIDEMethod } from './ipssub-sys-service-apidemethod';
import { IPSSubSysServiceAPIDTO } from './ipssub-sys-service-apidto';
import { IPSSubSysServiceAPIMethodInput } from './ipssub-sys-service-apimethod-input';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSSubSysServiceAPIMethodInputImpl extends PSModelObjectImpl implements IPSSubSysServiceAPIMethodInput {
  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  protected keypssubsysserviceapifield: IPSSubSysServiceAPIDEField | null = null;

  getKeyPSSubSysServiceAPIField(): IPSSubSysServiceAPIDEField | null {
    if (this.keypssubsysserviceapifield != null) return this.keypssubsysserviceapifield;
    const value = this.M.getKeyPSSubSysServiceAPIField;
    if (value == null) {
      return null;
    }
    const ipssubsysserviceapidemethod = this.getParentPSModelObject('service.IPSSubSysServiceAPIDEMethod') as IPSSubSysServiceAPIDEMethod;
    if (ipssubsysserviceapidemethod != null) {
      this.keypssubsysserviceapifield = ipssubsysserviceapidemethod.getPSSubSysServiceAPIDEMust().findPSSubSysServiceAPIDEField(value);
    }
    return this.keypssubsysserviceapifield;
  }

  get keyPSSubSysServiceAPIField(): IPSSubSysServiceAPIDEField | null {
    return this.getKeyPSSubSysServiceAPIField();
  }

  getKeyPSSubSysServiceAPIFieldMust(): IPSSubSysServiceAPIDEField {
    const value = this.getKeyPSSubSysServiceAPIField();
    if (value == null) {
      throw new Error('未指定外部服务接口主键属性');
    }
    return value;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected pssubsysserviceapidto: IPSSubSysServiceAPIDTO | null = null;

  getPSSubSysServiceAPIDTO(): IPSSubSysServiceAPIDTO | null {
    if (this.pssubsysserviceapidto != null) return this.pssubsysserviceapidto;
    const value = this.M.getPSSubSysServiceAPIDTO;
    if (value == null) {
      return null;
    }
    const ipssubsysserviceapi = this.getParentPSModelObject('service.IPSSubSysServiceAPI') as IPSSubSysServiceAPI;
    if (ipssubsysserviceapi != null) {
      this.pssubsysserviceapidto = ipssubsysserviceapi.findPSSubSysServiceAPIDTO(value);
    }
    return this.pssubsysserviceapidto;
  }

  get psSubSysServiceAPIDTO(): IPSSubSysServiceAPIDTO | null {
    return this.getPSSubSysServiceAPIDTO();
  }

  getPSSubSysServiceAPIDTOMust(): IPSSubSysServiceAPIDTO {
    const value = this.getPSSubSysServiceAPIDTO();
    if (value == null) {
      throw new Error('未指定外部服务接口DTO对象');
    }
    return value;
  }

  get type(): 'NONE' | 'KEYFIELD' | 'KEYFIELDS' | 'DTO' | 'DTOS' | 'UNKNOWN' | 'USER' | 'USER2' {
    return this.M.type;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get cls(): string {
    return 'PSSubSysServiceAPIMethodInputImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'dataentity.service.IPSDEMethodInput' || cls == 'service.IPSSubSysServiceAPIMethodInput') return true;
    return super.instanceof(cls);
  }
}
